package io.gitee.zhangbinhub.acp.boot.tools

import io.gitee.zhangbinhub.acp.core.common.CommonTools
import org.noear.solon.Solon
import java.net.UnknownHostException

class ServerTools {
    fun getServerPort(): Int = Solon.cfg().serverPort()
    fun getServerIp(): String = if (CommonTools.isNullStr(Solon.cfg().serverHost())) {
        try {
            IpTools.getServerIp() ?: ""
        } catch (e: UnknownHostException) {
            e.printStackTrace()
            ""
        }
    } else {
        Solon.cfg().serverHost()
    }
}